home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / pyshared / AppInstall / DialogMultipleApps.py < prev    next >
Encoding:
Python Source  |  2009-03-31  |  2.1 KB  |  53 lines

  1. # (c) 2005 Canonical, GPL
  2.  
  3. from SimpleGladeApp import SimpleGladeApp
  4. import gtk
  5. import gobject
  6. import os
  7. from Util import *
  8. from gettext import gettext as _
  9.  
  10. from widgets.AppListView import AppListView
  11.  
  12. class DialogMultipleApps(SimpleGladeApp):
  13.  
  14.     def __init__(self, datadir, parent, multiple_items_list, name, remove):
  15.         SimpleGladeApp.__init__(self,
  16.                                 path=datadir+"/gnome-app-install.glade",
  17.                                 root="dialog_multiple_apps",
  18.                                 domain="gnome-app-install")
  19.         self.store = gtk.ListStore(gobject.TYPE_STRING,
  20.                                    gobject.TYPE_PYOBJECT,
  21.                                    gobject.TYPE_INT)
  22.         for elm in multiple_items_list:
  23.             self.store.append((elm.name, elm, 0))
  24.         self.dialog_multiple_apps.set_transient_for(parent)
  25.         # Setup the application list
  26.         self.treeview_apps = AppListView(style=1)
  27.         self.scrolledwindow_multiple_apps.add(self.treeview_apps)
  28.         self.treeview_apps.set_headers_visible(False)
  29.         self.treeview_apps.set_model(self.store)
  30.         self.treeview_apps.show()
  31.         # Create the dialog message text
  32.         if remove == True:
  33.             header = (_("Remove %s and bundled applications?") % name)
  34.             msg = _("%s is part of a software collection. If you remove "
  35.                     "%s, you will remove all bundled applications as well.") %\
  36.                   (name, name)
  37.             label = _("_Remove All")
  38.         else:
  39.             header = (_("Install %s and bundled applications?") % name)
  40.             msg = _("%s is part of a software collection. If you install "
  41.                     "%s, you will install all bundled applications as well.") %\
  42.                   (name, name)
  43.             label = _("_Install All")
  44.         self.label_multiple.set_markup("<b><big>%s</big></b>\n\n%s" %\
  45.                                        (header, msg))
  46.         self.button_multiple_action.set_label(label)
  47.  
  48.     def run(self):
  49.         return self.dialog_multiple_apps.run()
  50.  
  51.     def hide(self):
  52.         self.dialog_multiple_apps.hide()
  53.